package secondStage.part5.多线程.线程同步;

/**
 * @ClassName: [SellTicket4]
 * @Description:
 * @Author: [黄劲松]
 * @CreateDate: [2021-04-05]
 * @Version: [v1.0]
 */
public class SellTicket implements Runnable {
    private int tickets = 100;

    @Override
    public void run() {
        while (true) {//死循环
            if (tickets > 0) {
                System.out.println(Thread.currentThread().getName() + "正在售票第" + tickets + "张票");
                tickets--;
            }
        }
    }
}
